

#import "AppDelegate.h"
#import "RootNavController.h"

//library
#import <MKNetworkKit/MKNetworkKit.h>
//#import <FlatUIKit/FlatUIKit.h>
#import <MBProgressHUD/MBProgressHUD.h>
#import <Mantle/Mantle.h>
#import <Masonry/Masonry.h>
#import <ODRefreshControl/ODRefreshControl.h>
#import <QRCodeReaderViewController/QRCodeReaderViewController.h>
#import <RDVTabBarController/RDVTabBarController.h>
#import <TMCache/TMCache.h>
#import <TPKeyboardAvoiding/TPKeyboardAvoidingTableView.h>
#import <TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.h>
#import <SCLAlertView-Objective-C/SCLAlertView.h>
#import <NYXImagesKit/NYXImagesKit.h>
#import <FMDB/FMDB.h>
#import <ReactiveCocoa/ReactiveCocoa.h>


//APP
#define kAPP_ID  @"fz572VIdsA62byxKOnQw"
#define kAPP_SECRET  @"OjC9qjEi5FP1qIxRpUuiTM0VvzEJDXO0"
#define USERAGENT @"OSChina.NET/iOS/5.0"
#define AppVersion @"1.7.6"
#define IS_IOS7 ([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0)

//API
#define HostName @"www.oschina.net"  //https:

#define api_news_list @"/action/api/news_list"
#define api_news_detail @"/action/api/news_detail"
#define api_post_list @"/action/api/post_list"
#define api_post_detail @"/action/api/post_detail"
#define api_post_pub @"/action/api/post_pub"
#define api_tweet_list @"/action/api/tweet_list"
#define api_tweet_detail @"/action/api/tweet_detail"
#define api_tweet_delete @"/action/api/tweet_delete"

#define api_tweet_pub @"/action/api/tweet_pub"
#define api_software_tweet_pub @"/action/api/software_tweet_pub"

#define api_active_list @"/action/api/active_list"
#define api_message_list @"/action/api/message_list"
#define api_message_delete @"/action/api/message_delete"
#define api_message_pub @"/action/api/message_pub"
#define api_comment_list @"/action/api/comment_list"
#define api_comment_pub @"/action/api/comment_pub"
#define api_comment_reply @"/action/api/comment_reply"
#define api_comment_delete @"/action/api/comment_delete"
#define api_login_validate @"/action/api/login_validate"
#define api_user_info @"/action/api/user_info"
#define api_user_information @"/action/api/user_information"
#define api_user_updaterelation @"/action/api/user_updaterelation"
#define api_notice_clear @"/action/api/notice_clear"
#define api_software_detail @"/action/api/software_detail"
#define api_blog_detail @"/action/api/blog_detail"
#define api_favorite_list @"/action/api/favorite_list"
#define api_favorite_add @"/action/api/favorite_add"
#define api_favorite_delete @"/action/api/favorite_delete"
#define api_user_notice @"/action/api/user_notice"
#define api_search_list @"/action/api/search_list"
#define api_friends_list @"/action/api/friends_list"
#define api_softwarecatalog_list @"/action/api/softwarecatalog_list"
#define api_software_list @"/action/api/software_list"
#define api_softwaretag_list @"/action/api/softwaretag_list"

#define api_software_tweet_list @"/action/api/software_tweet_list"

#define api_blogcomment_list @"/action/api/blogcomment_list"
#define api_blogcomment_pub @"/action/api/blogcomment_pub"
#define api_my_information @"/action/api/my_information"
#define api_blogcomment_delete @"/action/api/blogcomment_delete"
#define api_userblog_delete @"/action/api/userblog_delete"
#define api_userblog_list @"/action/api/userblog_list"
#define api_blog_list @"/action/api/blog_list"
#define api_userinfo_update @"/action/api/portrait_update"
#define api_report @"/action/communityManage/report"

//Controller Id
typedef NS_ENUM(NSInteger, PushType) {
    PushToUserInfo      = 1,
    PushToNews          = 2,
    PushToPost          = 3,
    PushToTweet         = 4,
    PushToBlog          = 5,
    PushToComment       = 6,
    PushToFavorite      = 7,
    PushTopProject      = 8,
    PushToMessage       = 9,
    PushTSearch         = 10,
    PushToUserNotice    = 11,
};



//单例对象
#define KeyWindow       (UIWindow *)[[UIApplication sharedApplication] keyWindow]
#define APP_DELEGATE    (AppDelegate *)[[UIApplication sharedApplication] delegate]

#define ROOT_NAV        (RootNavController *)[APP_DELEGATE rootNavVC]
#define APP_MANAGER     (AppManager *)[APP_DELEGATE appManager]
#define ENGINE          (NetEngine *)[APP_MANAGER netEngine]
#define ENQUE(operation) [ENGINE enqueueOperation:operation]

//Category
#import "BFKit.h"
#import "NSObject+BlockAddition.h"
//#import "NSDate+Common.h"
//#import "NSDate+convenience.h"
#import "NSObject+Common.h"
#import "NSObject+ObjectMap.h"
#import "ObjcRuntime.h"
//#import "UIColor+expanded.h"
#import "UIDevice+Common.h"
#import "UITapImageView.h"

//Log
#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"\nfunction:%s line:%d content:%s\n", __FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#elif
#define NSLog(FORMAT, ...) nil
#endif

//获取当前语言
#define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])

//NSUserDefaults 实例化
#define USER_DEFAULT (NSUserDefaults *)[NSUserDefaults standardUserDefaults]
#define SET_USER_DEFAULT(object, key) [USER_DEFAULT setObject:object forKey:key]
#define GET_USER_DEFAULT(key) [USER_DEFAULT objectForKey:key]

//main bundle 查找文件
#define FIND_FILE_FROM_MAINBUNDLE(fileName, suffix) (NSString *)[[NSBundle mainBundle] pathForResource:fileName ofType:suffix]

//release operation
#define RELEASE_AFN_OPERATION(operation) if([operation isKindOfClass:[AFHTTPRequestOperation class]] && ![operation isCancelled]) {[operation cancel];operation = nil;}
#define RELEASE_MK_OPERATION(operation) if([operation isKindOfClass:[MKNetworkOperation class]] && ![operation isCancelled]) {[operation cancel];operation = nil;}


#define  kBackButtonFontSize 16
#define  kNavTitleFontSize 19

#define MyLocalize(key)  (NSString *)NSLocalizedString(key, nil)



//